Claude: add support for multichannel interfaces on iOS/iPadOS#3746
Claude: add support for multichannel interfaces on iOS/iPadOS#3746rdica wants to merge 3 commits into
Conversation
|
I suggest to check any IPA files created by the CI |
|
Please check if you got an email from apple inviting you to test. Once it's approved, you should be able to test on your iDevice. |
There was a problem hiding this comment.
I've no iOS or macOS devices but the change looks coherent and compiles okay, so the API calls clearly exist.
We could do with more iOS and macOS testers, at least. This kind of thing does demonstrate how useful AI tools can be: but you still need to check that what you got is what you wanted.
|
Please do NOT merge this before we validated it does what it should do. |
ann0see
left a comment
There was a problem hiding this comment.
I'll need to review this. Review will follow.
| // channels we support (the actual channel count is only known once an | ||
| // input device has been selected and negotiated, see UpdateInputChannelInfo) | ||
| buffer.mNumberChannels = iNumInChan; | ||
| buffer.mData = malloc ( 256 * sizeof ( Float32 ) * MAX_NUM_IN_OUT_CHANNELS ); // max size |
There was a problem hiding this comment.
Stuff like this must be checked for memory bugs.
| break; | ||
| } | ||
|
|
||
| strDriverNames[lNumDevs] = QString ( "in: %1/out: System Default" ).arg ( QString::fromNSString ( port.portName ) ); |
|
|
||
| for ( int i = 0; i < iNumInChan; i++ ) | ||
| { | ||
| QString strChanName = QString ( "Channel %1" ).arg ( i + 1 ); |
| if ( ( iNewChan >= 0 ) && ( iNewChan < iNumInChan ) ) | ||
| { | ||
| iSelInputLeftChannel = iNewChan; | ||
| } |
There was a problem hiding this comment.
We don't give a failure if out of bounds? Does this follow the style on other OS?
Co-authored-by: ann0see <20726856+ann0see@users.noreply.github.com>
|
Per @ann0see's comments, get the LLM to check for coherency of approach with the other OS audio layer implementations, (rather than just a targeted fix). If might throw up some other things. It's always worth a starting a new conversation with the LLM - maybe a different model - to get a review, explicitly for comparison with the rest of the project for consistency. |
Short description of changes
Adds support for external multichannel interfaces and provides ability to choose inputs on iOS/iPadOS devices.
CHANGELOG: Added support for external multichannel interfaces and ability to choose inputs on iOS/iPadOS devices.
Context: Fixes an issue?
Fixes: 3735
Does this change need documentation? What needs to be documented and how?
I don't know.
Status of this Pull Request
What is missing until this pull request can be merged?
This absolutely needs testing as I have no means to do so.
I don't really expect this to work but hopefully it provides a starting point.
Claude summary:
What was missing:
src/sound/coreaudio-ios/sound.mmhardcoded a 2-channel (stereo) input format on the RemoteIO audio unit and never queriedAVAudioSessionfor a device's actual channel count, so any external multichannel interface (USB/Lightning audio interface) was silently truncated to its first two channels.Changes (
src/sound/coreaudio-ios/sound.{h,mm}):AVAudioSession.maximumInputNumberOfChannels/setPreferredInputNumberOfChannels:/inputNumberOfChannelswhenever a device is selected (SwitchDevice).iNumInChan-wide) and output (still stereo, since iOS playback is always 2-channel)AudioStreamBasicDescriptions applied to the RemoteIO unit.GetAvailableInOutDevices()now lists everyAVAudioSessionPortDescriptionin availableInputs (built-in mic, headset, external interfaces) instead of just "default" vs "built-in mic".UpdateInputChannelInfo()to populate per-channel names (fromAVAudioSessionChannelDescription) and clamp the current selection when the device changes.processBufferList()now indexes the interleaved N-channel buffer using the user-selected left/right channel instead of assuming channel 0/1.GetNumInputChannels,GetInputChannelName,SetLeft/RightInputChannel,GetLeft/RightInputChanneloverrides — these plug straight into the existing generic channel-selection UI inclientsettingsdlg.cpp, which is already gated on__APPLE__(true for iOS) and just was never exercised because the backend always reported 2 channels.No GUI changes were needed — the settings dialog's channel-selection frame already supports any platform reporting more than 2 channels.
Caveat: I don't have macOS/Xcode in this environment to actually build and run on a device, so this hasn't been compiled or tested against real hardware — please build it in Xcode and verify with an actual multichannel interface (e.g. plugged in via USB-C/Lightning) before merging.
END Summary
Checklist